package com.zxwl.base.dao;

import java.util.List;


public class DataPage<T>
{
	private int pageSize = 15;
	private int pageNum=1;
	private int rowSum;
	private int pageSum;
	private List<T> dataList;
	private QueryParameter queryParameter;
	private String hql;
	
	
	public DataPage()
	{
		try
		{
			pageSize = Integer.parseInt("15");
		}
		catch(Exception e)
		{
			pageSize = 15;
		}
	}
	
	public int getPageSize()
	{
		return pageSize;
	}
	public void setPageSize(int pageSize)
	{
		this.pageSize = pageSize;
	}

	public int getPageNum()
	{
		if(pageNum==0)
		{
			pageNum=1;
		}
		return pageNum;
	}
	public void setPageNum(int pageNum)
	{
		this.pageNum = pageNum;
	}

	public int getRowSum()
	{
		return rowSum;
	}
	public void setRowSum(int rowSum)
	{
		if(this.pageSize == 0)
		{
			this.pageSize = 15;
		}
		// 计算总页数
		this.pageSum = rowSum / this.pageSize;
		if(rowSum % pageSize > 0)
		{
			this.pageSum ++;
		}
		if(this.pageNum <= 0)
		{
			this.pageNum = 1;
		}
		if(this.pageNum > this.pageSum)
		{
			this.pageNum = this.pageSum;
		}
		
		this.rowSum = rowSum;
	}
	public int getPageSum()
	{
		if(pageSum==0)//总页数设置为一页
		{
			pageSum = 1;
		}
		return pageSum;
	}
	public void setPageSum(int pageSum)
	{
		this.pageSum = pageSum;
	}
	public List<T> getDataList()
	{
		return dataList;
	}
	public void setDataList(List<T> dataList)
	{
		this.dataList = dataList;
	}

	public void setHql(String hql)
	{
		this.hql = hql;
	}
	
	public String getHql()
	{
		return hql;
	}
	
	public QueryParameter getQueryParameter()
	{
		return queryParameter;
	}
	
	public void setQueryParameter(QueryParameter queryParameter)
	{
		this.queryParameter = queryParameter;
	}
	
}
